<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>物流状态查询</title>
  <script type="text/javascript" src="../static/js/jquery.min.js"></script>
  <link rel="stylesheet" type="text/css" href="../static/css/style.css">
    <link href="../static/icon/favicon.ico" rel="icon"/>
</head>

<body>
<div class="container">
  <h1 class="row skew-title">  
  <span>物</span><span>流</span><span>状</span><span>态</span><span>查</span><span>询</span>
  </h1>
</div>

<div class="input-container">
  <form action="#" onsubmit="return false;" method="post" id="userForm">
      <div class="input-field">
          <input type="text" id="OrderNumber" name="OrderNumber" required="">
          <label>请输入订单号</label>
          <span></span>
      </div>
      <input type="submit" id="login" value="确认" name="" class="btn">
  </form>
</div>

<div style="position:absolute;left:50%;top: 80%">
    <a href="Main.html" target="_self" class="ambi-light-button">回到主界面</a>
</div>

</body>

<script type="text/javascript">

    function statusQuery() {
        var orderNumber = document.getElementById('OrderNumber');
        if (orderNumber.value == "") {
            return;
        }
        if(orderNumber.value.length!=6){
            alert("订单号输入不正确");
            return;
        }
        $.ajax({
            type: "get",
            url: "/search/StatusQuery",
            data: {
                'OrderNumber': orderNumber.value
            },
            success: function (data) {
                if (data != "") {
                    alert(data)
                } else {
                    alert("未找到此订单或数据库正在进行写操作!");
                }
            },
            error: function () {
                console.log("物流信息查找异常");
                location.href="Error.html";
            }
        })
    }
    $("#login").click(function(){
        statusQuery();
    });
</script>

</html>